home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 10 / PC Guia 10.iso / database / shared.dir / 01039_Script_1039 < prev    next >
Text File  |  1996-03-14  |  6KB  |  234 lines

  1. -- clicked on the nav button
  2.  
  3. on ChapterClick
  4.   global gCurType, gQTstatus
  5.   
  6.   -- if we're in a QT article then kill the QT
  7.   if gCurType = "qt" or gCurType = "movie" and the framelabel = "qt" then 
  8.     if the movierate of sprite 16 then 
  9.       set gQTstatus = 1
  10.     else
  11.       set gQTstatus = 0
  12.     end if
  13.     
  14.     set the movierate of sprite 16 = 0
  15.     puppetsprite 16,1
  16.     set the loch of sprite 16 = 1000
  17.     
  18.   end if
  19.   
  20.   
  21.   ClickSnd
  22.   updatestage
  23.   NavButtonWindow
  24.   EndTrapMouse
  25. end
  26. -----------------------------------------------------------------------------------------
  27. on NavButtonClose
  28.   global gCurType
  29.   
  30.   if not rollover(33) then
  31.     if the puppet of sprite 33 then  
  32.       set the loch of sprite 33 = 1000
  33.       set the loch of sprite 34 = 1000
  34.       updatestage
  35.       puppetsprite 33,0
  36.       puppetsprite 34,0      
  37.     end if
  38.   end if
  39.   
  40.   if the framelabel = "qt" and gCurType = "movie" or gCurType = "qt" then
  41.     puppetsprite 16,0
  42.   end if
  43. end
  44. -----------------------------------------------------------------------------------------
  45. on NavButtonWindow
  46.   global gWorld
  47.   
  48.   puppetsprite 33,1
  49.   puppetsprite 34,1
  50.   
  51.   if gWorld = "senses" then
  52.     set the loch of sprite 33 = 428
  53.     set the loch of sprite 34 = 433
  54.   else if gWorld = "body" then
  55.     set the loch of sprite 33 = 358
  56.     set the loch of sprite 34 = 361
  57.   else if gWorld = "design" then
  58.     set the loch of sprite 33 = 352
  59.     set the loch of sprite 34 = 355
  60.   else if gWorld = "power" then
  61.     set the loch of sprite 33 = 327
  62.     set the loch of sprite 34 = 330
  63.   else if gWorld = "discover" then
  64.     set the loch of sprite 33 = 439
  65.     set the loch of sprite 34 = 442
  66.     
  67.   else if gWorld = "mind" then
  68.     set the loch of sprite 33 = 431
  69.     set the loch of sprite 34 = 433
  70.   end if
  71.   
  72.   set the height of sprite 33 = the height of cast "chaptertitles" + 10
  73. end
  74. -----------------------------------------------------------------------------------------
  75. on NavButtonUpdate
  76.   global gCurChap, gCurArticle, gArticles
  77.   
  78.   set numarticles = count(getat(garticles,gcurchap))
  79.   set the text of field "CurrentChapter" = line gcurchap of field "chaptertitles"
  80.   set the text of field "CurrentArticle" = gcurarticle && "of" && numarticles
  81.   
  82.   -- if only 1 article
  83.   if numarticles = 1 then 
  84.     set the visible of sprite 35 = 0
  85.     set the visible of sprite 36 = 0
  86.     --    puppetsprite 35,1
  87.     --    puppetsprite 36,1
  88.     --    set the loch of sprite 35 = 1000
  89.     --    set the loch of sprite 36 = 1000
  90.   else
  91.     set the visible of sprite 35 = 1
  92.     set the visible of sprite 36 = 1
  93.   end if
  94. end
  95.  
  96. -----------------------------------------------------------------------------------------
  97. on DoNugget
  98.   global gNuggetTime, gNuggetDelay, gNuggetOn, gWhichNugget, gMaxNuggets, gStartNuggetCast
  99.   global gInAMap
  100.   
  101.   if gInAMap then exit -- no nuggets while on the maps, because of the transitions
  102.   if gWhichNugget < 0 then exit
  103.   if the framelabel = "qt" then exit -- no nuggets on the qt
  104.   if the framelabel = "facts" then exit -- no nuggets on the flying facts screen
  105.   
  106.   set the itemdelimiter = "."
  107.   set tmp = item 2 of the framelabel
  108.   set the itemdelimiter = ","
  109.   
  110.   if tmp = "anim" then -- no nuggets on the animations
  111.     exit
  112.   end if
  113.   
  114.   if not gNuggetOn then 
  115.     if (the ticks - gNuggetTime) > gNuggetDelay then 
  116.       set gNuggetOn = 1
  117.     else
  118.       exit
  119.     end if
  120.   end if
  121.   
  122.   
  123.   set nsp = 47 -- nugget sprite
  124.   set speed = 5
  125.   
  126.   if not the puppet of sprite 47 then
  127.     set gStartNuggetCast = the castnum of sprite 47
  128.     puppetsprite 47,1
  129.     set the loch of sprite 47 = 635
  130.     set the locv of sprite 47 = 100 + random(200)
  131.   else
  132.     -- rotate through the nugget casts
  133.     set tmp = the castnum of sprite 47
  134.     if the name of cast tmp = "nugget6" then set tmp = gStartNuggetCast
  135.     else set tmp = tmp+1
  136.     set the castnum of sprite 47 = tmp
  137.     
  138.     set the loch of sprite 47 = the loch of sprite 47 - speed
  139.     if the loch of sprite 47 < 0 then
  140.       set gNuggetOn = 0 
  141.       set gNuggetTime = the ticks
  142.       puppetsprite 47,0
  143.       
  144.     end if
  145.   end if
  146.   
  147. end
  148. -------------------------------------------------------------------------
  149. -- when user clicks on nugget sprite, this gets run
  150.  
  151. on ShowNugget 
  152.   global gWhichNugget, gNuggets, gMaxNuggets, gNuggetOn, gNuggetTime, gNuggetList
  153.   
  154.   ClickSnd
  155.   updatestage
  156.   if gNuggetOn = 2 then exit
  157.   
  158.   set gNuggetOn = 2
  159.   set nsb = 46  -- blank
  160.   set nsp = 47  -- box
  161.   set nspt = 48 -- text
  162.   
  163.   set the itemdelimiter = "#"
  164.   set the text of field "nuggettext" = item gWhichNugget of gNuggets
  165.   set the itemdelimiter = ","
  166.   
  167.   set h = the height of cast "nuggettext"
  168.   set w = the width of cast "nuggettext"
  169.   
  170.   set x = the loch of sprite nsp
  171.   set y = the locv of sprite nsp
  172.   put x && y
  173.   
  174.   if x < 50 then 
  175.     set x = 50
  176.   else if x > 350 then 
  177.     set x = 350
  178.   end if
  179.   if y < 50 then
  180.     set y = 50
  181.   else if y > 400 then 
  182.     set y = 400
  183.   end if 
  184.   
  185.   put x && y
  186.   --  set x = 200
  187.   --  set y = 150
  188.   
  189.   set the castnum of sprite nsp = the number of cast "nuggetback"
  190.   spritebox nsp,x-15,y-15,(x+w+15),(y+h+15)
  191.   
  192.   set the loch of sprite nspt = x
  193.   set the locv of sprite nspt = y
  194.   
  195.   -- loop until the user does a mouseclick
  196.   set temptime = the ticks
  197.   
  198.   repeat while the mousedown
  199.     updatestage
  200.   end repeat
  201.   
  202.   repeat while (the ticks - temptime) < 30
  203.     updatestage
  204.   end repeat
  205.   
  206.   repeat while not the mousedown
  207.     updatestage
  208.   end repeat
  209.   
  210.   
  211.   -- get rid of the nugget
  212.   set gNuggetOn = 0 
  213.   set gNuggetTime = the ticks
  214.   
  215.   set the loch of sprite nsp = 1000
  216.   set the loch of sprite nspt = 1000
  217.   updatestage
  218.   
  219.   puppetsprite nsp,0
  220.   puppetsprite nspt,0
  221.   
  222.   
  223.   set gWhichNugget = random(gMaxNuggets)
  224.   set tmp = count(gNuggetList)
  225.   if tmp >= gMaxNuggets then 
  226.     set gWhichNugget = -1
  227.   else
  228.     repeat while getpos(gNuggetList,gWhichNugget)
  229.       set gWhichNugget = random(gMaxNuggets)
  230.     end repeat
  231.     add(gNuggetList,gWhichNugget)
  232.   end if
  233.   EndTrapMouse
  234. end